
const getJueJinList = async (id) => {
  if(!window.utools)return[];
  let res = await window.utools.ubrowser
  .goto("https://juejin.cn/hot/articles")
  // .devTools('right')
  .wait('.hot-list>a', 60000)
  .wait(200)
  .evaluate(() => {
    let hotList = document.querySelectorAll(".hot-list>a");
    let arr = [...hotList].map((item) => {
      let url = item.href;
      let articleNumber = item.querySelector(".article-number").innerText;
      let articleDetail = item.querySelector(".article-detail .article-title").innerText;
      let hotNumber = item.querySelector(".hot-number").innerText;

      return {
        url,
        index: articleNumber,
        detail: articleDetail,
        hot: hotNumber,
      };
    });
    return arr;
  })
  .run({ show: false });
  // .run({ width: 1300, height: 1000 });
  window.utools.clearUBrowserCache();
  return {
    id,
    list: res[0]
  }
};


export { getJueJinList };